import Vue from 'vue'
import Router from 'vue-router'
// pc端
//首页
const index = r => require.ensure([], () => r(require('@/page/home/index')), 'index')

//购物车
const cart = r => require.ensure([], () => r(require('@/page/cart/cart')), 'cart')
const cartEnter = r => require.ensure([], () => r(require('@/page/cart/cartEnter')), 'cartEnter')
const cartTop = r => require.ensure([], () => r(require('@/components/cartTop')), 'cartTop')

//个人信息
const about = r => require.ensure([], () => r(require('@/page/about/about')), 'about')
const aboutUp = r => require.ensure([], () => r(require('@/page/about/aboutUp')), 'aboutUp')
const aboutSuccess = r => require.ensure([], () => r(require('@/page/about/aboutSuccess')), 'aboutSuccess')

//我的订单
const orderList = r => require.ensure([], () => r(require('@/page/order/orderList')), 'orderList')
const orderShow = r => require.ensure([], () => r(require('@/page/order/orderShow')), 'orderShow')

//分类列表
const prcList = r => require.ensure([], () => r(require('@/page/home/prcList')), 'prcList')
const prcShow = r => require.ensure([], () => r(require('@/page/home/prcShow')), 'prcShow')
const prcSearch = r => require.ensure([], () => r(require('@/page/home/prcSearch')), 'prcSearch')

//注册
const register = r => require.ensure([], () => r(require('@/page/register/register')), 'register')
const registerSuccess = r => require.ensure([], () => r(require('@/page/register/registerSuccess')), 'registerSuccess')

//静态页面
const faqList = r => require.ensure([], () => r(require('@/page/faq/faqList')), 'faqList')
const faqA = r => require.ensure([], () => r(require('@/page/faq/faqA')), 'faqA')
const faqB = r => require.ensure([], () => r(require('@/page/faq/faqB')), 'faqB')
const faqC = r => require.ensure([], () => r(require('@/page/faq/faqC')), 'faqC')
const faqD = r => require.ensure([], () => r(require('@/page/faq/faqD')), 'faqD')
const faqE = r => require.ensure([], () => r(require('@/page/faq/faqE')), 'faqE')
const faqF = r => require.ensure([], () => r(require('@/page/faq/faqF')), 'faqF')
const faqG = r => require.ensure([], () => r(require('@/page/faq/faqG')), 'faqG')


// wap端
//登录
const login = r => require.ensure([], () => r(require('@/page/login/login')), 'login')
const cartSuccess = r => require.ensure([], () => r(require('@/page/cart/cartSuccess')), 'cartSuccess')


Vue.use(Router)

export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      component: index
    },
    {
      path: '/login',
      component: login
    },
    {
      path: '/prcList',
      component: prcList
    },
    {
      path: '/prcSearch',
      component: prcSearch
    },
    {
      path: '/prcShow',
      component: prcShow
    },
    {
      path: '/about',
      component: about,
      meta:{auth:true}
    },
    {
      path: '/aboutUp',
      component: aboutUp,
      meta:{auth:true}
    },
    {
      path: '/aboutSuccess',
      component: aboutSuccess
    },
    {
      path: '/orderList',
      component: orderList,
      meta:{auth:true}
    },
    {
      path: '/orderShow',
      component: orderShow,
      meta:{auth:true}
    },
    {
      path: '/cart',
      component: cart,
      meta:{auth:true}
    },
    {
      path: '/cartEnter',
      component: cartEnter
    },
    {
      path: '/cartSuccess',
      component: cartSuccess
    },
    {
      path: '/cartTop',
      component: cartTop
    },
    {
      path: '/register',
      component: register
    },
    {
      path: '/registerSuccess',
      component: registerSuccess
    },
    {
      path: '/faqList',
      component: faqList
    },
    {
      path: '/faqA',
      component: faqA
    },
    {
      path: '/faqB',
      component: faqB
    },
    {
      path: '/faqC',
      component: faqC
    },
    {
      path: '/faqD',
      component: faqD
    },
    {
      path: '/faqE',
      component: faqE
    },
    {
      path: '/faqF',
      component: faqF
    },
    {
      path: '/faqG',
      component: faqG
    },
    {
      path: '/*',
      component: index
    }
  ]
})
